using System;
using System.Threading.Tasks;
using HengTong.ViewModel.SupplyChain.SysMaterialAttributeVms;
using Microsoft.AspNetCore.Mvc;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc;

namespace HengTong.Areas.SupplyChain.Controllers
{
    [AuthorizeJwtWithCookie]
    public partial class SysMaterialAttributeController 
    {
        
        [ActionDescription("AI生成非关键属性")]
        [HttpPost("AiGenerateNonKeyAttributes")]
        public async Task<IActionResult> AiGenerateNonKeyAttributes([FromQuery] Guid materialId)
        {
            var vm = Wtm.CreateVM<SysMaterialAttributeListVm>(passInit: true);
            await vm.AiGenerateNonKeyAttributes(materialId);
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState.GetErrorJson());
            }
            else
            {
                return Ok(new { Message = "AI生成非关键属性成功" });
            }
        }
    }
}
